package com.smartplatform.task;

import com.smartplatform.event.SysHumitureCheckEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author 咕唧
 * @Date 2022/6/10 15:24
 * @Version 1.0
 */
@Component
public class SysHumitureTask {
    private ApplicationContext context;

    @Autowired
    public void setContext(ApplicationContext context) {
        this.context = context;
    }

    /**
     * 设置
     */
    @Scheduled(cron = "0/30 * * * * ?")
    public void checkSysHumiture() {
        context.publishEvent(new SysHumitureCheckEvent());
    }
}
